草庐IT

ios - App Transport Security 阻止 HTTPS

全部标签

ruby - Faye 在使用 https rails app 和 http faye app 时不工作

我有Rails应用程序,并使用apache和unicorn部署在AWSEC2中。在此应用程序中,我将faye用于消息传递模块。它在http应用程序中运行良好,但在将https(ssl)用于Web应用程序和将http用于Faye应用程序时,Faye无法正常工作。在这种情况下,我们真的需要两个应用程序(网络应用程序和faye应用程序)都使用https吗?请告诉我。错误:页面位于https://xxxx.xxxx已通过HTTPS加载,但请求了不安全的脚本“http://xxxxxx:9292/faye.js” 最佳答案 是的,您应该通过H

ruby-on-rails - 为什么 Rails Gemfile 默认为 https 而 http 使 bundler 更快?

gem文件中Rails的默认gems源是:source'https://rubygems.org'将其更改为source'http://rubygems.org'使bundle安装速度更快,因此我试图了解将https设为默认设置的决定背后的原因。有什么我需要注意的吗? 最佳答案 表格here:SwitchingtoHTTPisdangerous.ItopensyoutoMITMattacks.SwitchingtoHTTPallowshostilepartiestoreplacegemcontentswithmaliciouscon

ruby-on-rails - Postgres 不会使用 c9.io 连接到 Ruby on Rails 应用程序中的服务器

几天前,我成功地安装了Postgresql并从SQLite创建/迁移了我的数据库(为部署我的Rails4应用程序做准备)……我是这么想的。我重新启动了我的服务器,但是当我尝试访问我的应用程序时,出现了这个错误:PG::ConnectionBadcouldnotconnecttoserver:ConnectionrefusedIstheserverrunninglocallyandacceptingconnectionsonUnixdomainsocket"/var/run/postgresql/.s.PGSQL.5432"?我在SO上看到了几个类似的已回答问题,但它们都涉及Mac。由于

ruby - 使用 Net::HTTP block 形式的 HTTPS 请求——这可能吗?

要在没有block形式的情况下执行Net::HTTPhttps请求,您可以这样做:...http=Net::HTTP.new(url.host,url.port)http.use_ssl=true...但是有没有办法告诉Net::HTTP在进行block形式时使用https?u=URI.parse(url)Net::HTTP.start(u.host,u.port)do|http|#ifIputhttp.use_ssl=truehere,rubycomplainsthatthiscan't#bedonebecuasethesesionhasalreadystartedresp=http

ruby-on-rails - 检查 https 状态码 ruby

有没有办法在ruby​​中检查HTTPS状态代码?我知道可以使用require'net/http'在HTTP中执行此操作,但我正在寻找HTTPS。也许我需要使用不同的库? 最佳答案 您可以在net/http中执行此操作:require"net/https"require"uri"uri=URI.parse("https://www.secure.com/")http=Net::HTTP.new(uri.host,uri.port)http.use_ssl=truerequest=Net::HTTP::Get.new(uri.requ

ruby-on-rails - 阻止创建一个类的多个对象

如何将任何类的对象限制为一个。我的课看起来像:classSpeakerincludeMongoid::Documentfield:name,:type=>Stringend我只想让speaker的单个实例。一种方法是添加一个验证,该验证将检查Speaker类中已经存在的对象数量。有ruby做事的方式吗? 最佳答案 如何使用Singleton模块? 关于ruby-on-rails-阻止创建一个类的多个对象,我们在StackOverflow上找到一个类似的问题:

ruby - 上帝不会阻止 unicorn

我有这个文件rails_env=ENV['RAILS_ENV']||'development'rails_root=ENV['RAILS_ROOT']||"/home/luiz/rails_dev/api"God.watchdo|w|w.name="unicorn"w.interval=30.seconds#default#unicornneedstoberunfromtherailsrootw.start="cd#{rails_root}&&unicorn_rails-cconfig/unicorn.rb-E#{rails_env}"#QUITgracefullyshutsdownw

ruby - celluloid-io 或带有蚊子循环的 eventmachine

我正在构建一个小的ruby​​程序来运行与MQTT的连接。服务器并订阅channel。我正在使用mosquittogem这只是libmosquitto的桥梁C库。我创建了一个非常简单的程序实现,可以使用rubymy_prog.rb运行:#DependenciesrequireFile.expand_path(File.join('..','environment'),__FILE__)#MQTTApplicationmodulePulsrclassMQTTattr_reader:host,:port,:alivedefinitialize(host='iot.eclipse.org',

ruby - 带有临时文件的奇怪的 Ruby IO

这让我发疯。请考虑以下事项:require'open-uri'#setuptempfileextname=File.extnamefile_urlbasename=File.basename(file_url,extname)file=Tempfile.new([basename,extname])#readformURIintotempfileuri=URI.parse(file_url)num_bytes_writen=file.write(uri.read)puts"Wrote#{num_bytes_writen}bytes"#Readingfrommytempfileputs"

ruby-on-rails - Rails SSL 问题 : (https://example. com) 与 request.base_url (http ://example. com) 不匹配

我刚刚在我的网站上安装了SSL证书。不幸的是,它破坏了登录功能。在网站上提交登录表单后,它只是重定向到主页。检查Rails日志显示此错误:(https://example.com)didn'tmatchrequest.base_url(http://example.com)这是我的虚拟主机文件。我想我需要以某种方式强制使用SSL?ServerNameexample.comServerAliaswww.example.comRedirectpermanent/https://example.com/ServerAdminhello@example.comServerNameexample